package com.sy.servlet;

import com.sy.service.PriceService;
import com.sy.service.impl.PriceServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.UnsupportedEncodingException;

@WebServlet("/priceRanges/*")
public class PriceServlet extends AbstractBaseServlet {
    private PriceService priceService = new PriceServiceImpl();

    @Override
    protected Object doService(String action, HttpServletRequest req, HttpServletResponse res) throws UnsupportedEncodingException {
        //如果是查询所有价格区间
        if ("all".equals(action)) {
            return priceService.getAllPriceRanges();
        }
        return null;
    }
}
